let express = require('express')
let bodyParser = require('body-parser');

let Mock = require('mockjs');
let { v4 } = require('uuid')

let app = express();
app.use(bodyParser.urlencoded({
    extended: true
}));

//0.城市接口
app.get('/city', (req, res) => {
    res.send(Mock.mock({
        msg: 'success',
        'list|12': [{
            'id|+1': 1,
            'city|+1': ['北京', '上海', '深圳', '苏州', '杭州', '广州', '天津', '西安', '重庆', '武汉', '成都', '南京']
        }]
    }))
})

//1.轮播图接口
app.get('/banners', (req, res) => {
    res.send(Mock.mock({
        msg: '请求成功',
        code: 1,
        list: [{
            id: 1,
            url: 'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1831543070,2893603914&fm=26&gp=0.jpg',
            title: '这里是第一张轮播图',
            desc: '@cword(143,347)',
        }, {
            id: 2,
            url: 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2935749056,2440092995&fm=26&gp=0.jpg',
            title: '这里是第二张轮播图',
            desc: '@cword(143,347)',
        }, {
            id: 3,
            url: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=396195600,824883535&fm=26&gp=0.jpg',
            title: '这里是第三张轮播图',
            desc: '@cword(243,447)',
        }, {
            id: 4,
            url: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1693161012,3207107614&fm=26&gp=0.jpg',
            title: '这里是第四张轮播图',
            desc: '@cword(243,347)',
        }],
    })
    )
})
//2.导航接口
app.get('/nav', (req, res) => {
    res.send({
        msg: '请求成功',
        code: 1,
        list: [
            {
                id: 1001,
                imgUrl: 'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2540674196,3400971120&fm=26&gp=0.jpg',
                title: "转让出租"
            },
            {
                id: 1002,
                imgUrl: 'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=619879294,386704674&fm=26&gp=0.jpg',
                title: "招聘求职"
            },
            {
                id: 1003,
                imgUrl: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3733145459,2835986694&fm=26&gp=0.jpg',
                title: "流行产品 "
            },
            {
                id: 1004,
                imgUrl: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2622380841,1152030592&fm=26&gp=0.jpg',
                title: "培训课程"
            },
            {
                id: 1005,
                imgUrl: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1955667335,1213491571&fm=26&gp=0.jpg',
                title: "批发进货"
            }
        ]
    })
})

//3.两个小图
app.get('/navBar', (req, res) => {
    res.send({
        msg: '请求成功',
        code: 1,
        list: [{
            id: 1,
            url: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=142012161,971796448&fm=26&gp=0.jpg',
            title: '热门活动',
            desc: '满200减15'
        }, {
            id: 2,
            url: 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3214435661,323801352&fm=26&gp=0.jpg',
        }]
    })
})
//4.最热店铺数据
app.get('/hotShop', (req, res) => {
    res.send(Mock.mock({
        msg: "请求成功",
        code: 1,
        title: "最热店铺",
        imgUrl: "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2433375763,3930347838&fm=26&gp=0.jpg",
        'list|5': [
            {
                id: function () {
                    return v4();
                },
                'url|+1': ['https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=166238461,3355780917&fm=26&gp=0.jpg',
                    'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2258007532,2795806637&fm=15&gp=0.jpg',
                    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1971621269,3658599908&fm=26&gp=0.jpg',
                    'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1064936354,3613714352&fm=15&gp=0.jpg',
                    'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3237822290,3420597663&fm=26&gp=0.jpg'],
                title: '@cword(10,15)',
                desc: '@cword(20,25)',
                'price|10000-50000': 9,
                'area|300-900': 0,
                'location|1': ["北京市朝阳区", "北京市大兴区", "北京市海淀区", "天津市河东区", "上海市浦东区"],

                'zllx|1': ['店铺转租', '不要了', '转让'],
                'dplx|1': ['居民楼', '门店'],
                'szlc|1-3': 0,
                'szxq|1': ['A', 'B', 'C', 'D'],
                'szhx|1-6': 0,
                'szsq|1': ['小区', '大厦', '步行街'],

                // 店铺详情
                'cq|50-70': 0,
                'mtgd|2-4': 0,
                'js|1': ['有', '无'],
                'sffg|1': ['是', '否'],
                'mk|1-4': 1,
                'wzdcd|1': ['有', '无'],
                'jy|1': ['经营中', '已打样'],
                'ppqk|1': ['自营品牌', '连锁品牌'],
                'zjdz|1-20': 0,
                'zffs|1':['押一付三', '押一付六'] ,
            },
        ]
    }))
})
//5.人才库
app.get('/talents', (req, res) => {
    res.send(Mock.mock({
        msg: "请求成功",
        code: 1,
        title: "人才库",
        imgUrl: 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1607646084,4226833873&fm=26&gp=0.jpg',
        'list|5': [
            {
                id: function () {
                    return v4();
                },
                'job|1': ['美瞳师', '美甲师', '美妆师'],
                'url|+1': [
                    'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2935406241,2294251919&fm=15&gp=0.jpg',
                    'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2732978281,3905509160&fm=15&gp=0.jpg',
                    'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1227548960,3851046800&fm=15&gp=0.jpg',
                    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2026553487,3827682196&fm=26&gp=0.jpg',
                    'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=596967737,2665478882&fm=26&gp=0.jpg'
                ],
                uname: '@cname',
                'sex|1': ['女', '男'],
                'nianling|20-30': 0,
                word: '@cword(3,4)',
                desc: '@cword(20,25)',
                'yearA|3-5': 9,
                'yearB|1-3': 9,
                'yearC|1991-1999': 9,
                'xl|1': ['本科', '专科'],
                'price|10000-50000': 9,
                experience: function () {
                    return this.yearA === this.yearB ? this.yearA : this.yearB + '-' + this.yearA
                },

            }
        ]
    }))
})

//6.为你推荐
app.get('/recommend', (req, res) => {
    res.send(Mock.mock({
        msg: "请求成功",
        code: 1,
        'list|4': [
            {
                id: function () {
                    return v4();
                },
                'url|1': [
                    'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3722232089,1818523264&fm=26&gp=0.jpg',
                    'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3558679743,1527252395&fm=26&gp=0.jpg',
                    'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2043783071,1778442037&fm=26&gp=0.jpg',
                    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3344812253,1219882454&fm=26&gp=0.jpg',
                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2427933437,4007182465&fm=26&gp=0.jpg',
                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1668334450,2762311766&fm=26&gp=0.jpg',
                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3583422464,3653523406&fm=26&gp=0.jpg'
                ],
                'url1|1': [
                    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3344812253,1219882454&fm=26&gp=0.jpg',
                    'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3722232089,1818523264&fm=26&gp=0.jpg',
                    'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3558679743,1527252395&fm=26&gp=0.jpg',
                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2427933437,4007182465&fm=26&gp=0.jpg',
                    'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2043783071,1778442037&fm=26&gp=0.jpg',
                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1668334450,2762311766&fm=26&gp=0.jpg',
                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3583422464,3653523406&fm=26&gp=0.jpg'
                ],
                'url2|1': [
                    'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3722232089,1818523264&fm=26&gp=0.jpg',
                    'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2043783071,1778442037&fm=26&gp=0.jpg',
                    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3344812253,1219882454&fm=26&gp=0.jpg',
                    'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3558679743,1527252395&fm=26&gp=0.jpg',
                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2427933437,4007182465&fm=26&gp=0.jpg',
                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1668334450,2762311766&fm=26&gp=0.jpg',
                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3583422464,3653523406&fm=26&gp=0.jpg'
                ],
                desc: '@cword(20,25)',
                'price|500-5000': 9,
                'location|1': ["北京市朝阳区", "北京市大兴区", "北京市海淀区", "天津市河东区", "上海市浦东区"],
                'baozhang|1-3': 2,
                'huodong|1': ["暂无活动", "买一赠一", "打三折", "一折起"],
                canshu: "暂无信息",
                'pingjia|5': [
                    {
                        uname: '@cname',
                        desc: '@cword(20,25)',
                    }
                ]
            }
        ]
    }))
})

//7.美甲资讯
app.get('/manicure', (req, res) => {
    res.send(Mock.mock({
        msg: "请求成功",
        code: 1,
        title: '美甲资讯',
        imgUrl: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1147041237,3278942954&fm=26&gp=0.jpg',
        'list|2': [
            {
                'id|+1': 1021,
                'url|+1': [
                    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1869389714,3001418075&fm=26&gp=0.jpg',
                    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3733907940,3611324905&fm=26&gp=0.jpg'
                ],
                title: '@cword(10,15)',
                desc: '@cword(20,25)',
            }
        ]
    }))
})

//8.店铺接口
app.get("/shopData", (req, res) => {
    res.send(Mock.mock({
        msg: "请求成功",
        code: 1,
        title: '选址店铺',
        imgUrl: 'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3904596927,281929705&fm=26&gp=0.jpg',
        'list|10': [
            {
                id: function () {
                    return v4();
                },
                'url|1': [
                    'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1925450167,1162568555&fm=26&gp=0.jpg',
                    'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2385684009,3519435722&fm=26&gp=0.jpg',
                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2413751246,267264648&fm=26&gp=0.jpg',
                    'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1292098766,2458139990&fm=26&gp=0.jpg',
                    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3412115872,403572257&fm=26&gp=0.jpg',
                    'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3399522802,451793563&fm=26&gp=0.jpg',
                    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1850013856,493481627&fm=26&gp=0.jpg',
                    'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1485810395,1879994933&fm=26&gp=0.jpg',
                    'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2536401333,2095394990&fm=26&gp=0.jpg',
                    'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3042174752,751381523&fm=26&gp=0.jpg'
                ],
                title: '@cword(10,15)',
                desc: '@cword(20,25)',
                'price|10000-50000': 9,
                'area|300-900': 0,
                'location|1': ["北京市朝阳区", "北京市大兴区", "北京市海淀区", "天津市河东区", "上海市浦东区"],

                'zllx|1': ['店铺转租', '不要了', '转让'],
                'dplx|1': ['居民楼', '门店'],
                'szlc|1-3': 0,
                'szxq|1': ['A', 'B', 'C', 'D'],
                'szhx|1-6': 0,
                'szsq|1': ['小区', '大厦', '步行街'],

                // 店铺详情
                'cq|50-70': 0,
                'mtgd|2-4': 0,
                'js|1': ['有', '无'],
                'sffg|1': ['是', '否'],
                'mk|1-4': 1,
                'wzdcd|1': ['有', '无'],
                'jy|1': ['经营中', '已打样'],
                'ppqk|1': ['自营品牌', '连锁品牌'],
                'zjdz|1-20': 0,
                'zffs|1': ['押一付三', '押一付六'],
            }
        ]
    }))
})

//9.商城导航接口
app.get('/shopping', (req, res) => {
    res.send(Mock.mock({
        msg: "请求成功",
        code: 1,
        'list|10': [
            {
                id: function () {
                    return v4();
                },
                'title|+1': ['甲油胶', '潮流饰品', '美甲工具', '美睫工具', '美甲灯', '笔系列', '批发套装', '全部分类'],
                'url|1': [
                    'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3722232089,1818523264&fm=26&gp=0.jpg',
                    'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3558679743,1527252395&fm=26&gp=0.jpg',
                    'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2043783071,1778442037&fm=26&gp=0.jpg',
                    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3344812253,1219882454&fm=26&gp=0.jpg',
                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2427933437,4007182465&fm=26&gp=0.jpg',
                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1668334450,2762311766&fm=26&gp=0.jpg',
                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3583422464,3653523406&fm=26&gp=0.jpg'

                ],
                'uname|8':['北欧']
            }
        ]
    }))
})
//10.限时秒杀接口
app.get('/xsms', (req, res) => {
    res.send(Mock.mock({
        msg: "请求成功",
        code: 1,
        'list|10': [
            {
                id: function () {
                    return v4();
                },
                'title|+1': ['北欧401色', '北欧411色', '北欧421色', '北欧431色', '北欧441色', '北欧451色'],
                'url|1': [
                    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1869389714,3001418075&fm=26&gp=0.jpg',
                    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3733907940,3611324905&fm=26&gp=0.jpg',
                    'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2935406241,2294251919&fm=15&gp=0.jpg',
                    'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2732978281,3905509160&fm=15&gp=0.jpg',

                ],
                'price|13-25': 0,
            }
        ]
    }))
})

//11.精选套装接口
app.get('/jxtz', (req, res) => {
    res.send(Mock.mock({
        msg: "请求成功",
        code: 1,
        'list|10': [
            {
                id: function () {
                    return v4();
                },
                'title|+1': ['格拉图115色全套3.5ml', '格拉图145色全套5.5ml', '格拉图155色全套3.5ml', '格拉图127色全套3.5ml', '格拉图116色全套7.5ml', '格拉图785色全套10.5ml'],
                'url|1': [
                    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1869389714,3001418075&fm=26&gp=0.jpg',
                    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3733907940,3611324905&fm=26&gp=0.jpg',
                    'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2935406241,2294251919&fm=15&gp=0.jpg',
                    'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2732978281,3905509160&fm=15&gp=0.jpg',

                ],
                'price|190-250': 0,
                'kuaidi|1': ['包邮', '邮费自理'],
                'haoping|50-100': 0,
                'yonghu|5': [
                    {
                        uname: '@cname',
                        desc: '@cwword(20-50)',
                        'url|1': [
                            'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3344812253,1219882454&fm=26&gp=0.jpg',
                            'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2427933437,4007182465&fm=26&gp=0.jpg',
                            'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1668334450,2762311766&fm=26&gp=0.jpg',

                        ]
                    }
                ]
            }
        ]
    }))
})





// app.listen('3050',()=>{
//     console.log('3050')
// })

module.exports = app;